﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:o="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
    xmlns:l="http://wpflocalizeextension.codeplex.com"
    xmlns:local="clr-namespace:Imagin.Controls.Extended">
    <Style x:Key="{x:Type local:HexagonButton}" TargetType="{x:Type local:HexagonButton}">
        <Setter Property="GroupName" Value="Color" />
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <Canvas Margin="{TemplateBinding Margin}">
                        <Path 
                            x:Name="Path" 
                            Data="M 0,-1 L +0.866,-0.5 L +0.866,+0.5 L 0,+1 L -0.866,+0.5 L -0.866,-0.5 Z" 
                            RenderTransform="12,0,0,12,0,0" 
                            Fill="{TemplateBinding Background}" 
                            Stroke="{TemplateBinding Foreground}" 
                            StrokeThickness="{Binding StrokeThickness, RelativeSource={RelativeSource TemplatedParent}}">
                        </Path>
                    </Canvas>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsChecked" Value="True">
                <Setter Property="Foreground" Value="Black"/>
            </Trigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsChecked" Value="False"/>
                    <Condition Property="UsesGradients" Value="True"/>
                </MultiTrigger.Conditions>
                <Setter Property="Foreground" Value="Transparent" />
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsChecked" Value="False"/>
                    <Condition Property="UsesGradients" Value="False"/>
                </MultiTrigger.Conditions>
                <Setter Property="Foreground" Value="{Binding Background, RelativeSource={RelativeSource Self}}" />
            </MultiTrigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>